﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.Linq;

public class MapCell : MonoBehaviour
{
    /// <summary>
    /// 地格种类
    /// </summary>
    public CellType cellType;
    /// <summary>
    /// 地格状态
    /// </summary>
    public CellState cellState;
    /// <summary>
    /// 雷的数量
    /// </summary>
    public int mineCount;
    /// <summary>
    /// 是否显示
    /// </summary>
    public bool isDisplay;
    private void Start()
    {
        Debug.Log("Triggered");
        //cellState = CellState.Null;
        this.transform.GetComponent<Button>().onClick.AddListener(Click);
        isDisplay = false;

    }
    void Click()
    {
        if (cellState == CellState.Chess) return;
        Map map = this.GetComponentInParent<Map>();
        map.clickedCell = map.cellDIC.FirstOrDefault(q => q.Value == this).Key;
        TurnController.Instance.GetPlayer().OnclickCells(map.clickedCell);
    }
}
public enum CellType 
{ 
   Black,
   Blue,
    Red
}
public enum CellState
{
    Null,
    OriMine,
    RMine,
    BMine,
    Chess
}


